package com.UnionPayCenter.account.enums;

import com.UnionPayCenter.enums.CodeBaseEnum;
import com.UnionPayCenter.exception.ApiException;

/**
 * 资金流水类型枚举
 */
public enum FundsBillTypeEnum implements CodeBaseEnum {

    PAY(1, "支付流水"),
    CHARGE(2, "充值流水"),
    ;

    private int code;

    private String msg;

    FundsBillTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static FundsBillTypeEnum getEnum(int code) {
        for (FundsBillTypeEnum ele : FundsBillTypeEnum.values()) {
            if (ele.code == code) {
                return ele;
            }
        }
        throw new ApiException(404, "不正确的流水类型");
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }
}
